import { WebGLRenderTarget, WebGLRenderTargetOptions } from "../../thirdparty/three/imports";
import { DepthTexture3D } from "../textures/DepthTexture3D";
import { Texture3D } from "../textures/Texture3D";

export class WebGLRenderTarget3D
{
    _target: WebGLRenderTarget;

    get texture()
    {
        const text = Texture3D.get(this._target.texture);

        return text;
    }

    get depthTexture()
    {
        const depthTexture3D = DepthTexture3D.get(this._target.depthTexture);

        return depthTexture3D;
    }
    set depthTexture(v)
    {
        this._target.depthTexture = v._texture;
    }

    get stencilBuffer()
    {
        return this._target.stencilBuffer;
    }
    set stencilBuffer(v)
    {
        this._target.stencilBuffer = v;
    }

    constructor(width?: number, height?: number, options?: WebGLRenderTargetOptions)
    {
        this._target = new WebGLRenderTarget(width, height, options);
    }

    dispose()
    {
        this._target.dispose();
    }

    setSize(width: number, height: number, depth?: number)
    {
        this._target.setSize(width, height, depth);
    }
}
